import React from 'react';
import { View } from 'react-native';
import PropTypes, { oneOfType } from 'prop-types';
import { px2dp } from 'bee/utils/px2dp';
import { colors, sizes } from 'bee/themes';
import { Icon, Names } from 'bee/components/Icon';

const BackBtn = ({ navigation }) => (
  <View style={{ paddingLeft: px2dp(30) }}>
    <Icon
      name={Names.fanhui}
      color={colors.white}
      size={sizes.f3}
      onPress={() => navigation.goBack()}
    />
  </View>
);

BackBtn.propTypes = {
  navigation: PropTypes.objectOf(oneOfType([PropTypes.func, PropTypes.object]))
    .isRequired,
};

export default BackBtn;
